package com.qf.utils;

import com.zhenzi.sms.ZhenziSmsClient;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class SendUtils {
    public static int SendMes(String tel) throws Exception {
        ZhenziSmsClient client = new ZhenziSmsClient("https://sms_developer.zhenzikj.com",
                "109234", "023be269-1847-4b47-838e-cc4e7fd8794b");
        try {
            Random random = new Random();
            int i = random.nextInt(8999) + 1000;
            Map<String, Object> params = new HashMap();
            params.put("number", tel);
            params.put("templateId", "5571");
            String s = Integer.toString(i);
            String[] templateParams = new String[]{s, "10分钟"};
            System.out.println("templateParams = " + templateParams);
            params.put("templateParams", templateParams);
            String result = client.send(params);
            return i;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return -1;
    }
}
